package com.sky.controller.user;

import com.sky.entity.Category;
import com.sky.service.CategoryService;
import com.sky.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController("userCategoryController")
@Slf4j
public class CategoryController {

    @Autowired
    CategoryService categoryService;

    /*
    *
    * 根据分类类型查询分类
    * */
    @GetMapping("/user/category/list")
    public Result<List<Category>> list(Integer type){
        log.info("用户端 根据分类类型查询分类，{}", type);
        return Result.success(categoryService.selectByType(type));
    }
}
